<?php /*a:5:{s:66:"/home/pirate/wx_manager/app/autoreply/view/admin/autokey_list.html";i:1606984065;s:35:"../app/common/admin/lib/header.html";i:1622026634;s:36:"../app/common/admin/lib/sidebar.html";i:1606282475;s:39:"../app/autoreply/view/lib/top_menu.html";i:1606966586;s:35:"../app/common/admin/lib/footer.html";i:1620273611;}*/ ?>
<?php
use app\common\config\autoreply_config;
use app\common\helper\index_msg_helper;
use app\common\helper\appmsg_helper;
use app\common\helper\autoreply_helper;
use app\common\model\User;
?>
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title><?php if($title): ?><?php echo htmlentities($title); ?>-<?php endif; ?>微信后台管理</title>
  <base href="<?php echo htmlentities(SITE_URL); ?>/"></base>
  <script type="text/javascript">
    var siteUrl = "<?php echo htmlentities(SITE_URL); ?>";
    var uploadUrl = "<?php echo htmlentities(UPLOAD_URL); ?>";
    var isAdmin = 1;
  </script>
  
  <link rel="stylesheet" type="text/css" href="./static/css/base.css" />
  <link rel="stylesheet" type="text/css" href="./static/css/admin/admin.css" />
  <link rel="stylesheet" href="/static/lib/layui-v2.5.4/css/layui.css" media="all">

  <?php if(in_array($module, explode(',', ',autoreply,appmsg,appmenu,appmenu_stat,key_stat,message,user'))): ?>
  <link rel="stylesheet" type="text/css" href="./static/css/admin/weixin.css" />
  <?php endif; ?>

  <script type="text/javascript" src="./static/js/jquery-1.7.1.min.js"></script>
  <script type="text/javascript" src="./static/js/jqueryui/1.8.11/jquery-ui.js"></script>
  <script type="text/javascript" src="./static/js/common.js"></script>
  <script type="text/javascript" src="./static/js/admin/admin.js"></script>
  <script type="text/javascript" src="./static/js/qDialog.js"></script>
  <script type="text/javascript" src="./static/js/zclip/jquery.zclip.min.js"></script>
  <script type="text/javascript" src="./static/js/zclip/ZeroClipboard.js"></script>
  <link rel="shortcut icon" href="./favicon.ico">
  <script src="/static/lib/layui-v2.5.4/layui.js?v=1.0.4" charset="utf-8"></script>
  <script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
  <link rel="stylesheet" href="/static//css/admin/weiboface.css" type="text/css" />
  <script type="text/javascript" src="/static//js/weiboface.js"></script>
  <!--[if IE 6]>
  <script src="./static/js/DD_belatedPNG_0.0.8a-min.js"></script>
  <script>
    DD_belatedPNG.fix('.logo a,.n-icon');
  </script>
  <![endif]-->
  <script>
  $(function(){
    // 页面高度
    var windowHeight = $(window).height();
    var domHeight = $(document).height();
    if (domHeight > windowHeight) {
      windowHeight = domHeight;
    }
    if ($(".inner-center").height() < windowHeight - 66) {
      $(".inner-center").css('min-height', windowHeight - 66);
      //$('body').css('overflow', 'hidden');
    }
    
    // 用户设置浮层
    $(".js_userSetBtn").click(function(e){
     e.preventDefault();
     e.stopPropagation();
     
     $(".js_cardSetBox").addClass('hidden');
     if ($(".js_userSetBox").hasClass('hidden')) {
       $(".js_userSetBox").removeClass('hidden');
     } else {
       $(".js_userSetBox").addClass('hidden');
     }
    });

      // 公众号下拉浮层
      $(".js_cardSetBtn").click(function(e){
          e.preventDefault();
          e.stopPropagation();

          $(".js_userSetBox").addClass('hidden');
          if ($(".js_cardSetBox").hasClass('hidden')) {
              $(".js_cardSetBox").removeClass('hidden');
          } else {
              $(".js_cardSetBox").addClass('hidden');
          }
      });

      // 表情初始化
      weiboFaceInit({
          //emotionUrl: "javascript:;",
          data: <?php echo config('emotion.weixin_emotions'); ?>
      });
  });
  </script>
</head>
<body>

<div id="wrap">
  <div class="header">
    <div class="htop clearfix">
      
      <h1 class="logo left" style="width:300px;"><a href="<?php echo url('admin'); ?>">微信后台管理 [<?php echo htmlentities($open_card_info['title']); ?>] </h1>
      <?php if($user_id > 0): ?>
        
        <div class="infotop">
          <a href="javascript:void(0);" class="userpic"></a>
          <span class="username-right js_userSetBtn">
            <a href="javascript:;" class="username"><?php echo User::display_name($user_id); ?></a>
            <span class="arrowtop">
              <i></i>
            </span>
          </span>
          <div class="poptop poptop-user js_userSetBox hidden" style="background:white;">
            <em>◆</em>
            <ul>
              
              <li><a href="<?php echo url('home'); ?>">回前台</a></li>
              <li><a href="<?php echo url('/admin/logout/index'); ?>">退出</a></li>
            </ul>
          </div>
        </div>
      <?php else: ?>
        <div class="htop-login right">
          <a href="<?php echo url('admin'); ?>">登录</a>
          <a href="<?php echo url('user/register'); ?>">注册</a>
        </div>
      <?php endif; ?>
    </div>
  </div>
  <div class="container clearfix">
    <div class="sidebar left">
  <ul class="sidenav">
  <!-- {an_dump($sidebar_menu_list)} -->
    <?php foreach($sidebar_menu_list as $k=>$v): ?>
    <li class="js_topMenu">
      <a href="javascript:;"><?php echo htmlentities($v['title']); ?><em></em></a>
      <?php if($v['children']): ?>
      <ul class="sidenav2" style="display:none;">
        <?php foreach($v['children'] as $k1=>$v1): ?>
        <li class="<?php echo htmlentities($v1['curr']); ?>">
          <a href="<?php echo htmlentities($v1['url']); ?>" data-qian="vmodule::<?php echo htmlentities($v1['module']); ?> vcontroller::<?php echo htmlentities($v1['controller']); ?> vaction::<?php echo htmlentities($v1['action']); ?> ___ module::<?php echo htmlentities($module); ?> controller::<?php echo htmlentities($controller); ?> action::<?php echo htmlentities($action); ?> __ vextra::<?php echo htmlentities($v1['extra_res']); ?> extra::<?php echo htmlentities($extra_res); ?> vcurr::<?php echo htmlentities($v1['curr']); ?>"><?php echo htmlentities($v1['title']); ?>&nbsp;&nbsp;<i style="display:none;" style="color:red">(0)</i></a>
        </li>
        <?php endforeach; ?>
      </ul>
      <?php endif; ?>
    </li>
    <?php endforeach; ?>
  </ul>
</div>
<script>
$(function(){
  $('.js_topMenu').click(function(e){
    
    var s=e.target || e.srcElement;
    if ($(s).parents(".sidenav2").size()>0) {
      return;
    }

    $(this).siblings().removeClass('curr')
    $(this).siblings().find('ul:visible').slideUp();
    if (!$(this).find('ul:visible').length) {
      $(this).find('ul').slideDown();
      $(this).addClass('curr');
    } else {
      $(this).find('ul').slideUp();
      $(this).removeClass('curr');
    }
  });
  
  $(".sidenav2 li").each(function(i, n){
    if ($(this).hasClass('curr')) {
      $(this).closest('ul').show();
      $(this).closest('.js_topMenu').addClass('curr');
    };
  });
});
</script>
    <div class="center">
      <div class="inner-center">
<?php echo htmlentities($type = autoreply_config::$autoreply_type); ?>
<div class="replynav">
  <ul class="rnav-list clearfix">
    <?php foreach($type as $k=>$v): ?>
      <li <?php if($k == $autoreply_type): ?> class="curr" <?php endif; ?>><a href='<?php echo url("/autoreply/admin/$k"); ?>'><?php echo htmlentities($v); ?></a></li>
    <?php endforeach; ?>
  </ul>
</div>
<div class="rlbox">
  <!--start:关键词回复列表-->
  <div class="page-header clearfix">
    <div class="page-header-intro left">在这里设置：通过匹配用户输入的内容，来自动回复<br>例如：当用户输入“会员”，会查找是否设置了会员关键词，如果有，则回复对应的信息</div>
    <a href='<?php echo url("/autoreply/add/3"); ?>' class="btn btn-success btn-sm right">添加规则</a>
  </div>
  <div class="search-level1 clearfix">
    <form action='<?php echo url("/autoreply/admin/3"); ?>' method="get">
      <input type="hidden" name="is_advenced" value="0">
      <input <?php if($is_advenced == 1): ?>style="display:none;"<?php endif; ?> type="text" class="left" name="search[title]" value="<?php echo htmlentities($search_filter['title']); ?>">
      <button <?php if($is_advenced == 1): ?>style="display:none;"<?php endif; ?> type="submit" class="btn btn-success btn-sm left">搜索</button>
      <a href="javascript:void(0);" class="close js_advanced <?php if($is_advenced == 1): ?>js_isOpen open<?php endif; ?>">高级搜索<em></em></a>
    </form>
  </div>
  <div class="search-form js_advancedForm" <?php if($is_advenced == 0): ?>style="display:none;"<?php endif; ?>>
    <form action='<?php echo url("/autoreply/admin/3"); ?>' method="get">
      <input type="hidden" name="is_advenced" value="1">
      <p>
        <label for="" class="search-f-label">规则名称：</label>
        <input type="text" class="search-f-ipt1" name="search[title]" value="<?php echo htmlentities($search_filter['title']); ?>">
      </p>
      <p>
      <label for="" class="search-f-label">添加时间：</label>
        <input type="text" class="search-f-ipt1 search-f-ipt2" name="search[start_date]" value="<?php echo htmlentities($search_filter['start_date']); ?>" id="startDate">
        <span class="search-f-line"></span>
        <input type="text" class="search-f-ipt1 search-f-ipt2" name="search[stop_date]" value="<?php echo htmlentities($search_filter['stop_date']); ?>" id="stopDate">
      </p>
      <p><label for="" class="search-f-label"></label><button type="submit" class="btn btn-success btn-sm js_searchBtn">搜索</button></p>
    </form>
  </div>
  <table class="list-table table-sm table-sm01 table table-bordered" cellpadding="0" cellspacing="0" style="width:100%;">
    <thead>
      <tr>
        <th style="width:16%;">规则名</th>
        <th style="width:250px;">关键词</th>
        <th style="width:120px;">关键词对应的回复</th>
        <th style="width:125px;">添加时间</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
    <?php if(!empty($list['data'])): foreach($list['data'] as $k=>$v): ?>
          <tr data-id="<?php echo htmlentities($v['id']); ?>">
            <td><?php if(!$v['title']): ?>--<?php else: ?><?php echo htmlentities($v['title']); ?><?php endif; ?></td>
            <td <?php echo htmlentities($content_count = autoreply_helper::get_autoreply_content_count($v['id'])); if($content_count != 1): ?> valign="top" <?php endif; ?>>
              <?php echo htmlentities($key_list = autoreply_helper::get_autoreply_key_list($v['id'], 2)); if($key_list): foreach($key_list as $k1 => $v1): ?>
                  <div class="list-per-keywords js_perKey" data-id="<?php echo htmlentities($v1['id']); ?>" data-match="<?php echo htmlentities($v1['match_type']); ?>" <?php if(!isset($key_list[$k1+1])): ?>style="border-bottom:0 none;"<?php endif; ?>>
                    <span style="display:inline-block;width:150px;overflow:hidden;"><?php echo htmlentities($v1['title']); ?></span>
                    <span class="js_perMatch" style="color:#39b3d7; font-size:12px; cursor:pointer; display:none;"><?php if($v1['match_type'] == 1): ?>未全匹配<?php else: ?>全部匹配<?php endif; ?></span>
                  </div>
                <?php endforeach; ?>
              <?php endif; ?>
            </td>
            <td><?php echo autoreply_helper::get_autoreply_content_str($v['id']); ?></td>
            <td><?php echo time_format($v['add_time']); ?></td>
            <td>
              <a href='<?php echo url("/autoreply/add/3", ["id"=>$v['id']]); ?>' class="btn btn-info btn-xs">编辑</a>
              <a href="javascript:void(0);" class="btn btn-danger btn-xs js_deleteKey" data-id="<?php echo htmlentities($v['id']); ?>">删除</a>
            </td>
          </tr>
      <?php endforeach; else: ?>
        <tr><td colspan="5">暂无数据</td></tr>
    <?php endif; ?>
    </tbody>
  </table>

  <!--end:关键词回复列表-->
</div>

<div id="pages"></div>
<script>
$(function(){
  // 高级搜索
  $('.js_advanced').click(function(e){
    e.preventDefault();
    var thisObj = $(this);
    var outBox  = thisObj.closest('form');
    if (thisObj.hasClass('js_isOpen')) {
      thisObj.removeClass('js_isOpen open');
      outBox.find('input').show();
      outBox.find('button').show();
      $('.js_advancedForm').hide();
    } else {
      thisObj.addClass('js_isOpen open');
      outBox.find('input').hide();
      outBox.find('button').hide();
      $('.js_advancedForm').show();
    }
  });

  // 匹配的显示与隐藏
  $(".js_perKey").mouseover(function(){
    $(this).find(".js_perMatch").show();
  }).mouseout(function(){
    $(this).find(".js_perMatch").hide();
  })
  
  // 匹配情况调整
  $(".js_perMatch").click(function(){
    var thisObj = $(this);
    var thisClosest = thisObj.closest('.js_perKey');

    if (thisClosest.attr('is-post') == 1) {
      showMsg('数据提交中', 0);
      return;
    }
    
    var id         = thisClosest.closest('tr').attr('data-id');
    var matchType  = thisClosest.attr('data-match');
    var keyId      = thisClosest.attr('data-id');
    
    thisClosest.attr('is-post', 1);
    var postData = { 'id':id, 'match_type':matchType, 'key_id':keyId };
    $.post(siteUrl+'/autoreply/admin/change_match_type', postData, function(json){
      thisClosest.attr('is-post', 0);
      if (json.info != 'ok') {
        showMsg(json.info, 0);
        return;
      }
      
      thisClosest.attr('data-match', json.match_type);
      if (json.match_type == 2) {
        thisObj.html('全部匹配');
      } else {
        thisObj.html('未全匹配');
      }
    }, 'json');
  });
  
  // 高级搜索时间验证
  $('.js_searchBtn').click(function(e){
    e.preventDefault();
    var thisObj   = $(this);
    var startDate = $.trim($('#startDate').val());
    var stopDate  = $.trim($('#stopDate').val());
    if (startDate > stopDate) {
      showMsg('结束时间应大于等于开始时间');
      return;
    }
    thisObj.closest('form').submit();
  });
  
  var isPost = false;
  $('.js_deleteKey').click(function(e){
    e.preventDefault(); 
    var thisObj = $(this);
    var id = thisObj.attr('data-id');
    showConfirm('您确定要删除该关键字吗？', 1, function(){
      if (isPost) {
        showMsg('正在提交中，请稍候');
        return;
      }
      isPost = true;
      $.post(
        siteUrl+'/autoreply/delete/3',
        {
          'id':id,
          'type':'key'
        },
        function(json) {
          isPost = false;
          if (json.info != 'ok') {
            showMsg(json.info);
            return;
          }
          thisObj.closest('tr').remove();
        },'json'
      );
    });
  });
});
</script>
      </div>
      
    </div>
  </div>
      
      <div class="linkpop js_menuSetBox" style="display:none;">
          <div class="inner-linkpop">
      <span>
        <i class="arrowpop"></i>
        <b class="arrowpop2"></b>
      </span>
              <p class="options-list">
                  <!--<a class="js_menuIndexBtn" href="javascript:void(0);">关联到微官网</a>-->
                  <a class="js_menuLinkBtn" href="javascript:void(0);">跳转到网页</a>
                  <a class="js_menuTextBtn" href="javascript:void(0);">纯文字回复</a>
                  <a class="js_menuSingleBtn" href="javascript:void(0);">单条图文信息</a>
                  <a class="js_menuMultiBtn" href="javascript:void(0);">多条图文信息</a>
                  <a class="js_menuActivityBtn" href="javascript:void(0);">活动回复</a>
                  <!--{*<a class="js_menuImgBtn" href="javascript:void(0);">图片</a>-->
                  <!--<a class="js_menuVoiceBtn" href="javascript:void(0);">声音</a>-->
                  <!--<a class="js_menuCustomBtn" href="javascript:void(0);">智能回复</a>*}-->
              </p>
          </div>
      </div>

</div>
<span class="goTop go-top-box" style="display:none;"></span>
<script>
$(function(){
  // to-top
  goTopEx($(".goTop")[0]);
  // 点击其他地方隐藏弹层
  $(document).click(function(e){
    var s=e.target || e.srcElement;
    // 隐藏图文信息的编辑框
    if (!$(s).is('.js_showSetBoxBtn') && !$(s).is('.js_setBox') && $(s).parents(".js_setBox").size()<1) {
      $(".js_setBox").addClass('hidden');
    }
    
    // 隐藏个人设置弹框
    if (!$(s).is('.js_userSetBtn') && !$(s).is('.js_userSetBox') && $(s).parents(".js_userSetBox").size()<1) {
      $(".js_userSetBox").addClass('hidden');
    }
    
    // 隐藏个人设置弹框
    if (!$(s).is('.js_cardSetBtn') && !$(s).is('.js_cardSetBox') && $(s).parents(".js_cardSetBox").size()<1) {
      $(".js_cardSetBox").addClass('hidden');
    }
    
    // 隐藏菜单设置弹框
    if (!$(s).is('.js_setBtn') && !$(s).is('.js_menuSetBox') && $(s).parents(".js_menuSetBox").size()<1 && !$(s).is('.js_addNewContent') && $(s).parents(".js_addNewContent").size()<1) {
      $(".js_menuSetBox").hide();
    }
    
    // 隐藏表情弹框
    if (!$(s).is('#weiboface') && $(s).parents("#weiboface").size()<1 && !$(s).is('.js_faceBtn') && $(s).parents(".js_faceBtn").size()<1) {
      $("#weiboface").hide();
    }
    
    // 隐藏首页二维码
    if (!$(s).is('.js_mPreviewBtn') && $(s).parents(".js_mPreviewBtn").size()<1 && !$(s).is('.js_mPreviewBox') && $(s).parents(".js_mPreviewBox").size()<1) {
      $(".js_mPreviewBox").hide();
    }
    
    // 隐藏颜色框
    if (!$(s).is('.js_selectColorBtn') && $(s).parents(".js_selectColorBtn").size()<1 && !$(s).is('.js_selectColorBox') && $(s).parents(".js_selectColorBox").size()<1) {
      $(".js_selectColorBox").hide();
    }
    
    // 隐藏图标框
    if (!$(s).is('.js_selectIconBtn') && $(s).parents(".js_selectIconBtn").size()<1 && !$(s).is('.js_selectIconBox') && $(s).parents(".js_selectIconBox").size()<1) {
      $(".js_selectIconBox").hide();
    }
  });

    layui.use(['form', 'laypage'], function () {
        var form = layui.form
            , laypage = layui.laypage;

        laypage.render({ //分页
            elem: 'pages'
            , count: "<?php echo htmlentities($list['total']); ?>"
            , theme: '#FFB800'
            , limit: "<?php echo htmlentities($list['per_page']); ?>"
            , curr: "<?php echo htmlentities($list['current_page']); ?>"
            , jump:function(obj, first) {
                if (!first) {
                    //location.href = "?page="+obj.curr
                    var query = window.location.href;

                    var url = query.split("?")[0]+"?page="+obj.curr;
                    location.href = url;
                }
            }
        });
    });
});
</script>
</body>
</html>